define([
	'jquery',
	'underscore',
	'backbone',
	'baseView',
	'js/myUtil.js',
	'react',
	'react_dom',
	'jsx!forum/login2/CLogin.js'
], function($, _, Backbone, BaseView, myUtil, React, ReactDOM, CLogin) {
	return BaseView.extend({
		render: function(cb) {
			var self = this;
			myUtil.isLogined(function(err, res) {
				if (res && res.errCode === 0) {
					console.log('already login');
					window.location.href = "#forum/thread";
					window.blueInk.removeModule('#forum/login2');
				} else {
					console.log('not login');
					ReactDOM.render(React.createElement(CLogin, null), $(self.el).get(0));
					if (!$(self.el).is(":visible")) // if hide then show
						self.show();
					cb && cb();
				}
			});
		}
	});
});